package programDetails;

/**
 * @Description: 位运算
 * @Date: 2020/4/21
 * @Author: 许群星
 */
public class _2_5_BitOperation {
    public static void main(String[] args) {
        //1、判断奇偶性可以用位运算判断，奇数&1为1，偶数为0
        for (int i = 0; i < 5; i++) {
            System.out.println(i+"个"+(i&1));
            System.out.println(i+"个---"+(i&0));
        }

        //2、乘法用<<,每乘2相当于右边加1
        int a=2*2;
        int b=2<<1;
        System.out.println("a="+a);
        System.out.println("b="+b);
    }
}
